package cn.yunhe.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import cn.yunhe.dao.IUserDao;
import cn.yunhe.model.User;
import cn.yunhe.service.IUserService;
import cn.yunhe.util.PageUtil;

@Service("userService")
public class UserServiceImpl implements IUserService {

	@Resource
	private IUserDao userDao;

	public User selectByPrimaryKey(int userId) {
		return userDao.selectByPrimaryKey(userId);
	}

	public List<User> selectAll() {
		return userDao.selectAll();
	}

	public int addUser(User user) {
		return userDao.addUser(user);
	}

	public int delUser(int id) {
		return userDao.delUser(id);
	}

	public Integer selectByNameAndPass(User user) {
		return userDao.selectByNameAndPass(user);
	}

	public Page queryUsersByPage(int currPage, int pageSize) {
		Page page = PageHelper.startPage(currPage, pageSize);
		List<User> list=userDao.selectAll();
		return page;
	}

	public IUserDao getUserDao() {
		return userDao;
	}

	public void setUserDao(IUserDao userDao) {
		this.userDao = userDao;
	}

}
